package com.dufang.mybytestream;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;

public class ByteStreamDemo5 {
    public static void main(String[] args)  {
        FileWriter fw=null;
        try{
            fw=new FileWriter("\\1.txt");
            fw.write("哈哈哈");//假如这里写失败或者携成功了
        }catch (IOException e){
            throw new RuntimeException(e);
        }finally {
            if(fw!=null){
                try{
                    fw.close();
                }catch (IOException e){
                    throw new RuntimeException(e);
                }
            }
        }

    }
}
